{% extends 'TopxiaWebBundle:User:layout.html.twig' %}

{% block title %}{{ parent() }}{% endblock %}

{% set pageNav = 'favorited' %}

{% block main %}
  <div class="course-list">
    <div class="row">
      {% for courseFavorite in courseFavorites if courseFavorite %}
        
        {% if courseFavorite.type == 'course' %}
          {% set course = data('Course',{courseId:courseFavorite.courseId}) %}
          <div class="col-lg-3 col-md-4 col-xs-6">
            {% include 'TopxiaWebBundle:Course:Widget/course-grid.html.twig' %}
          </div>
        {% elseif courseFavorite.type == 'openCourse' %}
          {% set course = data('OpenCourse',{courseId:courseFavorite.courseId})|default(null) %}
          {% if course %}
            <div class="col-lg-3 col-md-4 col-xs-6">
              {% include 'TopxiaWebBundle:OpenCourse/Widget:open-course-grid.html.twig' %}
            </div>
          {% endif %}
        {% endif %}
        
      {% else %}
          <div class="empty">{{'无收藏的课程'|trans}}</div>
      {% endfor %}
    </div>
  </div>
  <nav class="text-center">
    {{ web_macro.paginator(paginator) }}
  </nav>
{% endblock %}

